
function validate_required(field)
{
with (field)
  {
  if (value==null||value=="")
    {
	return false;
	}
  else {return true;}
  }
}

function get_value(field)
{
with (field)
  {
	  return value;
  }
}

function validate_form(thisform)
{
	with (thisform) {
		 if (validate_required(email)==false) {
				var $emailName = $('.cemail');
				if($.trim($emailName.val()) == ''){
						$emailName.alert('please input email', {alertClass: 'corner',position: 'bottom'});
				}
				email.focus();
				return false;
			}
			if (validate_required(passwd)==false){
						var $passName = $('.cpasswd');
						if($.trim($passName.val()) == ''){
							$passName.alert('please input passwd',  {alertClass: 'corner',position: 'bottom'});
						}
					   // passwd.focus();
						return false;
				}
  }
}

function validate_login_form(thisform)
{
	with (thisform) {
		 if (validate_required(email)==false) {
				var $emailName = $('.lemail');
				if($.trim($emailName.val()) == ''){
						$emailName.alert('please input email', {alertClass: 'corner',position: 'right'});
				}
				email.focus();
				return false;
			}
			if (validate_required(passwd)==false){
						var $passName = $('.lpasswd');
						if($.trim($passName.val()) == ''){
							$passName.alert('please input passwd',  {alertClass: 'corner',position: 'right'});
						}
					    passwd.focus();
						return false;
				}
  }
}
	
function validate_reset_form(thisform)
{
	with (thisform) {
		 if (validate_required(old_password)==false) {
				var $emailName = $('#account_password_old');
				if($.trim($emailName.val()) == ''){
						$emailName.alert('please input old password', {alertClass: 'corner',position: 'right'});
				}
				return false;
			}
			if (validate_required(account_password)==false){
						var $passName = $('#account_password');
						if($.trim($passName.val()) == ''){
							$passName.alert('please input new password',  {alertClass: 'corner',position: 'right'});
						}
					   // passwd.focus();
						return false;
				}
		 if (validate_required(account_password_confirm)==false) {
				var $emailName = $('#account_password_confirm');
				if($.trim($emailName.val()) == ''){
						$emailName.alert('please input confirm password', {alertClass: 'corner',position: 'right'});
				}
				return false;
			}
		 if (get_value(account_password_confirm) != get_value(account_password)) {
				var $emailName = $('#account_password_confirm');
				$emailName.alert('One of the new password mistyped? ');
				return false;
			}

  }
}
	
